<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">

    <p:dialog header="Adauga/Editeaza document" widgetVar="add_document_WV" dynamic="true"
              minHeight="300" width="600" modal="true" closeOnEscape="true">

        <h:form id="create_document_form">

            <h:panelGrid columns="2" columnClasses="column-1, column-200" styleClass="form-elements">

                <p:outputLabel for="doc_type" value="Tip document:"/>
                <p:selectOneMenu id="doc_type" value="#{additionalDataBean.selectedDocument.documentType}" required="true"
                                 style="width: 200px;"
                                 converter="#{objectMappingConverter}">
                    <f:selectItem itemLabel="Selectati ..."/>
                    <f:selectItems var="d" value="#{additionalDataBean.documentTypes}"
                                   itemLabel="#{d.name}" itemValue="#{d}"/>
                </p:selectOneMenu>

                <p:outputLabel for="doc_number" value="Seria/Numarul"/>
                <p:inputText id="doc_number" value="#{additionalDataBean.selectedDocument.number}" required="true"/>

                <p:outputLabel for="doc_residence" value="Domiciliul"/>
                <p:inputText id="doc_residence" value="#{additionalDataBean.selectedDocument.residenceVisa}" required="true"/>

                <p:outputLabel for="doc_issue_date" value="Data emiterii"/>
                <p:calendar id="doc_issue_date" value="#{additionalDataBean.selectedDocument.issueDate}"
                            required="true" pattern="dd/MM/yyyy"/>

                <p:outputLabel for="doc_office" value="Autoritatea emitenta"/>
                <p:inputText id="doc_office" value="#{additionalDataBean.selectedDocument.office}" required="true"/>
            </h:panelGrid>

            <p:outputPanel layout="block" style="border-top: 1px solid #A8A8A8; padding: 5px;">
                <p:commandButton icon="ui-icon-disk" value="Salveaza"
                                 update="@form :folder_details_content:folder_details_content:documents_form"
                                 actionListener="#{additionalDataBean.saveDocument}"
                                 oncomplete="if (args &amp;&amp; !args.validationFailed) add_document_WV.hide()"/>
                <p:commandButton value="Renunta" onclick="PF('add_document_WV').hide();" process="@none"/>
            </p:outputPanel>
        </h:form>
    </p:dialog>


</ui:composition>
